﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;

namespace TemplateEngine
{
    /// <summary>
    /// A class which produces templates
    /// </summary>
    [ContractClass(typeof(ITemplateFactoryContract))]
    public interface ITemplateFactory
    {
        /// <summary>
        /// Fecthes or Creates a template with the specified name
        /// </summary>
        /// <param name="name">The name of the template to find or create</param>
        /// <returns>The corresponding template or null if none found that match</returns>
        ITemplate GetTemplate(String name);
    }

    [ContractClassFor(typeof (ITemplateFactory))]
    internal abstract class ITemplateFactoryContract : ITemplateFactory
    {
        public ITemplate GetTemplate(string name)
        {
            Contract.Requires(name != null);
            Contract.Requires(name.Length > 0);
            return null;
        }
    }
}
